<template>
  <div class="cover-preview">
    <div class="cover-preview-show">
      <img :src="coverUrl" alt="cover-preview-show" />
      <div class="cover-upload-show-tip">
        <span class="cover-upload-show-tip-upload">上传封面</span>
        <span class="cover-upload-show-tip-edit">裁剪修改</span>
      </div>
    </div>
    <input type="file" accept="image/jpeg, image/jpg, image/png" />
  </div>
</template>

<script>
export default {
  props: {
    coverUrl: {
      type: String,
      default: "",
    },
  },
};
</script>

<style lang="scss" scoped>
.cover-preview {
  width: 200px;
  height: 126px;
  cursor: pointer;
  position: relative;
}
.cover-preview-show {
  height: 100%;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.cover-upload-show-tip {
  position: absolute;
  right: 0;
  bottom: 0;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-justify-content: space-around;
  -ms-flex-pack: distribute;
  justify-content: space-around;
  font-size: 12px;
  color: #fff;
  text-align: center;
  line-height: 26px;
  width: 100%;
  border-radius: 4px 0 4px 0;
  z-index: 100;
}
.cover-upload-show-tip-upload {
  width: 50%;
  background: rgba(0, 0, 0, 0.5);
  margin-right: 2px;
}
.cover-upload-show-tip-edit {
  width: 50%;
  background: rgba(0, 0, 0, 0.5);
  margin-left: 2px;
}
</style>